﻿using System;
using NBehave.Spec.NUnit;
using NUnit.Framework;
using SilverlightCalculator.CalculatorValidationRules;

namespace SilverlightCalculator.Tests.CalculatorValidationRules
{
    [TestFixture]
    public class When_validating_value_is_not_null_or_empty
    {
        [Test]
        public void Should_return_false_when_value_is_null()
        {
            // Arrange
            var validateValueIsNotNullOrEmpty = new ValidateValueIsNotNullOrEmpty();

            // Act
            var result = validateValueIsNotNullOrEmpty.IsValid(null);

            // Assert
            result.ShouldBeFalse();
        }

        [Test]
        public void Should_return_false_when_value_is_empty()
        {
            // Arrange
            var validateValueIsNotNullOrEmpty = new ValidateValueIsNotNullOrEmpty();

            // Act
            var result = validateValueIsNotNullOrEmpty.IsValid(String.Empty);

            // Assert
            result.ShouldBeFalse();
        }
        
        [Test]
        public void Should_return_true_when_value_is_not_null_or_empty()
        {
            // Arrange
            var validateValueIsNotNullOrEmpty = new ValidateValueIsNotNullOrEmpty();

            // Act
            var result = validateValueIsNotNullOrEmpty.IsValid("AAA");

            // Assert
            result.ShouldBeTrue();
        }
    }
}